package com.hualan.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hualan.mapper.ConsultFeedbackMapper;
import com.hualan.pojo.ConsultFeedback;
import com.hualan.service.ConsultFeedBackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConsultFeedbackImpl implements ConsultFeedBackService {
    @Autowired
    private ConsultFeedbackMapper consultFeedbackMapper;
    @Override
    public PageInfo<ConsultFeedback> findByType(Integer pageNum, Integer pageSize, String type) {
        PageHelper.startPage(pageNum,pageSize);
        List<ConsultFeedback> consultFeedbacks = consultFeedbackMapper.selectAllByConsultType(type);
        return new PageInfo<>(consultFeedbacks);
    }

    @Override
    public int deleteFeedback(Long id) {
        return consultFeedbackMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insertFeedback(ConsultFeedback consultFeedback) {
        return consultFeedbackMapper.insert(consultFeedback);
    }

    @Override
    public int deleteBatch(List<Integer> ids) {
        return consultFeedbackMapper.deleteBatch(ids);
    }

    @Override
    public int updateFeedback(Integer id, String feedback) {
        return consultFeedbackMapper.updateByPrimaryKey(id,feedback);
    }


}
